package com.ruoyi.project.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.project.domain.Order;
import com.ruoyi.project.domain.Project;
import com.ruoyi.project.service.IOrderService;
import com.ruoyi.system.service.impl.SysUserServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("res/order")
public class OrderController extends BaseController {

    @Resource
    private IOrderService orderService;
    @Resource
    private SysUserServiceImpl userService;

    /**
     * 获取账户金额
     * @return
     */
    @RequestMapping("/getBalance")
    @ResponseBody
    public AjaxResult getBalance() {
        return AjaxResult.success("操作成功", userService.selectUserById(ShiroUtils.getUserId()));
    }

    @PostMapping("edit")
    @ResponseBody
    public AjaxResult editSave(Project pro){
        return toAjax(orderService.save(pro));
    }
}
